<template>
  <div class="user-dept-role-selector">
    <div class="selector-wrapper">
      <div class="box-wrapper">
        <div class="box-title">选择：</div>
        <div class="box-content">
          <SeachInput :typeArr="dataTypeArr" @search="search" />
          <el-button-group class="tab-group">
            <el-button
              v-for="tab in tabs"
              :key="tab.value"
              round
              :type="activeTab === tab.value ? 'primary' : ''"
              @click="() => (activeTab = tab.value)"
            >
              {{ tab.label }}
            </el-button>
          </el-button-group>
          <div></div>
        </div>
      </div>
      <div class="box-wrapper">
        <div class="box-title">已选：</div>
        <div class="box-content"></div>
      </div>
    </div>
    <div class="selector-control-bar">
      <el-button @click="cancel">取消</el-button>
      <el-button type="primary" @click="submit">确认</el-button>
    </div>
  </div>
</template>

<script setup lang="ts">
const dataTypeArr = ref([
  {
    label: '用户',
    value: '1'
  },
  {
    label: '部门',
    value: '2'
  },
  {
    label: '角色',
    value: '3'
  }
])
const tabs = ref([
  {
    label: '部门架构',
    value: 1
  },
  {
    label: '角色列表',
    value: 2
  }
])
const activeTab = ref(1)
const breadcrumbs = ref([])
// 用户信息
const users = ref([])
// 部门信息
const depts = ref([])
// 角色信息
const roles = ref([])
// 已选列表
const selected = ref([])

const cancel = () => {
  console.log('cancel')
}
const submit = () => {
  console.log('submit')
}
// 关键词搜索过滤
const search = ({ type, keyword }: { type: string; keyword: string }) => {
  console.log(type, keyword)
}
defineExpose({
  init() {}
})
</script>

<style lang="scss" scoped>
.user-dept-role-selector {
  .selector-wrapper {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    .box-wrapper {
      width: 45%;
      height: 450px;
      .box-title {
        font-size: 16px;
        line-height: 40px;
      }
      .box-content {
        width: 100%;
        height: 410px;
        padding: 10px;
        border-radius: 5px;
        background: #eeeeee;
        .tab-group {
          width: 100%;
          margin: 10px auto;
          button {
            width: 50%;
          }
        }
      }
    }
  }
  .selector-control-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }
}
</style>
